Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit ee9335517e1fe7c6a9faea4b41c70e2ea0b96fda


Parents : 1e96540 828623c
Author : markqvist <mark@unsigned.io>
Signature : Signature validation error
Date : 2025-11-10T11:45:15+01:00
Committer : GitHub <noreply@github.com>
Date : 2025-11-10T11:45:15+01:00

Merge pull request #109 from alligitor/Heltec_V3_Battery_Status

Fixed reading of battery voltage for Heltec V3.2.

Diff

diff --cc Power.h
index 766bf55,2f474f0..5eedf45
--- a/Power.h
+++ b/Power.h
@@@ -367,13 -348,26 +367,30 @@@ bool init_pmu()
pinMode(pin_vbat, INPUT);
return true;
#elif BOARD_MODEL == BOARD_HELTEC32_V3
+ // there are three version of V3: V3, V3.1, and V3.2
+ // V3 and V3.1 have a pull up on pin_ctrl and are active low
+ // V3.2 has a transistor and active high
+ // put the pin input mode and read it. if it's high, we have V3 or V3.1
+ // other wise, it's a V3.2
+ uint16_t pin_ctrl_value;
+ uint8_t pin_ctrl_active = LOW;
+ pinMode(pin_ctrl, INPUT);
+ pin_ctrl_value = digitalRead(pin_ctrl);
+ if(pin_ctrl_value == HIGH) {
+ // We have either a V3 or V3.1
+ pin_ctrl_active = LOW;
+ }
+ else {
+ // We have a V3.2
+ pin_ctrl_active = HIGH;
+ }
pinMode(pin_ctrl,OUTPUT);
- digitalWrite(pin_ctrl, LOW);
+ digitalWrite(pin_ctrl, pin_ctrl_active);
return true;
+ #elif BOARD_MODEL == BOARD_HELTEC32_V4
+ pinMode(pin_ctrl,OUTPUT);
+ digitalWrite(pin_ctrl, LOW);
+ return true;
#elif BOARD_MODEL == BOARD_HELTEC_T114
pinMode(pin_ctrl,OUTPUT);
digitalWrite(pin_ctrl, HIGH);


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────